const path = require("path");

function resolve(dir) {
    return path.join(__dirname, dir);
}


module.exports = {
    configureWebpack: {},
    lintOnSave: false, //关闭eslint检查代码
    productionSourceMap: false, // 是否在构建生产包时生成 sourceMap 文件，false将提高构建速度
    runtimeCompiler: true, // 运行时版本是否需要编译
    //productionGzip:true,
    publicPath: './', // 设置打包文件相对路径
    devServer: {
        proxy: {
            '/api': {
                target: 'http://testapi.link.jzsoft.cn',
                changeOrigin: true,
                ws: true,
                pathRewrite: {
                    '^/api': ''
                }
            }
        },
        disableHostCheck: true, //修改了host指向之后需要把这个设置为true，这个是关闭ip检测，打包的时候注掉
    },
    chainWebpack: config => { //配置图片转base64的下限，单位b
        config.module
            .rule('images')
            .use('url-loader')
            .loader('url-loader')
            .tap(options => Object.assign(options, { limit: 1 }))
        config.plugins.delete('prefetch')
        config.resolve.alias
            .set("@", resolve("src"))
            .set("assets", resolve("src/assets"))
            .set("components", resolve("src/components"))
            .set("base", resolve("baseConfig"))
            .set("public", resolve("public"));

    },
}